/*
 * data_event.cpp
 *
 *  Created on: 30.06.2013
 *      Author: SpirTanol
 */

#include "events/data_event.h"
#include "packets/data_packet.h"
#include "packets/config_packet.h"
#include "packets/run_config_packet.h"
#include "packets/crash_oscillogram_packet.h"
#include "packets/watch_data_packet.h"
#include "packets/protocol_packet.h"
#include "packets/crash_protocol_packet.h"

// Qt
#include <QDebug>
//=================================================================================================
DataEventGet::DataEventGet(const WatchDataPacket *data) : DataEvent(DET_GET_DATA), oData(data->clone())
{

}

DataEventGet::~DataEventGet()
{
	delete oData;
}
//=================================================================================================
DataEventGetProtocol::DataEventGetProtocol(const ProtocolPacket *eventProtocol, const CrashProtocolPacket *crashProtocol) :
		DataEvent(DET_GET_PROTOCOLS), oEventProtocol(eventProtocol->clone()), oCrashProtocol(crashProtocol->clone())
{

}

DataEventGetProtocol::~DataEventGetProtocol()
{
	delete oCrashProtocol;
	delete oEventProtocol;
}
//=================================================================================================
ConfigEvent::ConfigEvent(const ConfigPacket *packet, ConfigEventType type) : DataEvent(DET_CONFIG), oConfig(packet->clone()), oType(type)
{

}

ConfigEvent::~ConfigEvent()
{
	delete oConfig;
}
//=================================================================================================
RunConfigEventGet::RunConfigEventGet(const RunConfigPacket *packet) : DataEvent(DET_RUN_CONFIG_GET), oRunConfig(packet->clone())
{

}

RunConfigEventGet::~RunConfigEventGet()
{
	delete oRunConfig;
}
//=================================================================================================
RunConfigEventProgress::RunConfigEventProgress(const RunConfigProgressPacket *packet) : DataEvent(DET_RUN_CONFIG_PROGRESS), oProgress(packet->clone())
{

}

RunConfigEventProgress::~RunConfigEventProgress()
{
	delete oProgress;
}
//=================================================================================================
CrashEventOscillogramGet::CrashEventOscillogramGet(const CrashOscillogramPacket *packet) : DataEvent(DET_CRASH_OSCILLOGRAM_GET),
		oData(packet->clone())
{

}

CrashEventOscillogramGet::~CrashEventOscillogramGet()
{
	delete oData;
}
